<?php

require_once '../include/common.inc.php';

if (!checkAdmin()) {
    header("LOCATION:index.php");
    exit;
}

$menu_index = 1;
$page_title = 'JANSEN';
$guide_message = 'Product | Basic Infomation | Add';
$code = (isset($_POST['code']) && $_POST['code'] != "Enter code ...") ? $_POST['code'] : "";
$inventory_ary = array();
$category_ary = array();

// All inventory
$sql = "SELECT `id`, `name`, `seq`, `type` FROM `inventory` ORDER BY `seq`";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {
    $inventory_ary[] = $rs;
}
$inventory_ary_num = count($inventory_ary);



//Setting
$sql = "SELECT `id`, `name`  FROM `p_setting` WHERE `ispublish` = 1";
$arySetting = $db->get_ary($sql);

//Collection
$sql = "SELECT `id`, `name`  FROM `p_collection` WHERE `ispublish` = 1 order by orderindex";
$aryCollection = $db->get_ary($sql);

//Finishes
$sql = "SELECT `id`, `name`  FROM `p_finish_set`";
$aryFinishes = $db->get_ary($sql);

//Style / Priod
$sql = "SELECT `id`, `name`  FROM `p_style` WHERE `ispublish` = 1";
$aryStyle = $db->get_ary($sql);

//fabrics
$fabrics="";
$sql = "SELECT * FROM `p_fabric_category` ORDER BY `seq`";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) 
{
   
   if(!empty($rs['name']))
   {
    $fabrics.='<option  value="f_'.$rs['id'].'">' .$rs['name'].'</option>//n';
	}
}
if( ! empty($fabrics))
{
	$fabrics = "<optgroup label=\"Fabrics Category\">".$fabrics."</optgroup>";
}

//leather
$leathers="";
$sql = "SELECT * FROM `p_leather_category` ORDER BY `seq`";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) 
{
   if(!empty($rs['name']))
    $leathers.='<option value="l_'.$rs['id'].'">' .$rs['name'].'</option>//n';
}
if( ! empty($leathers))
{
	$leathers = "<optgroup label=\"Leather Category\">".$leathers."</optgroup>";
}

//Defined in function file
$out_cate = GetProductCate($_categories,0);

require_once PrintEot('a_header');
require_once PrintEot('a_p_product_add');
require_once PrintEot('a_footer');

?>